#!/usr/bin/env python  
import os  
from app import create_app,db  
from app.models import User,Role 
from flask_script import Manager,Shell  
from flask_migrate import Migrate,MigrateCommand  

app=create_app(os.getenv('FLASK_CONFIG') or'default')  
manager=Manager(app)  
migrate=Migrate(app,db)  

@manager.command
def test():
    """Run the unit tests"""
    import unittest
    
    #这里tests=unittest.TestLoader().discover('tests')是创建了单元测试的实例，
    #其中discover中我们传入的参数是单元测试的模块名称，也就是下图中的test文件夹
    tests=unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)

@manager.command  
def myprint():  
    print('hello world')  
  
if __name__=='__main__':  
    manager.run()  


## https://blog.csdn.net/hyman_c/article/details/52886805?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

#python manager.py test  执行